package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.po.InteractionReply;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author hrz
 * @since 2025-08-29
 */
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
public class InteractionReplyController {
    private final IInteractionReplyService replyService;

    @PostMapping
    @ApiOperation("新增回答或评论")
    public void saveReply(@Validated @RequestBody ReplyDTO replyDTO) {
        replyService.saveReply(replyDTO);
    }

    @GetMapping("/page")
    @ApiOperation("问答详情页的分页查询")
    public PageDTO<ReplyVO> pagequery(@RequestBody ReplyPageQuery replyPageQuery){
        return replyService.pagequery(replyPageQuery);
    }


}
